Skip to content

feat(server-utils): Allow integrations to be part of marker#22094

Merged
JPeer264 merged 4 commits into
developfrom
jp/orchestrion-integrations
Jul 21, 2026
Merged

feat(server-utils): Allow integrations to be part of marker#22094
JPeer264 merged 4 commits into
developfrom
jp/orchestrion-integrations

Conversation

@JPeer264

@JPeer264 JPeer264 commented Jul 8, 2026

Copy link
Copy Markdown
Member

This adds a way to add orchestrion integrations into the bundle during the build time and dev for only that things which are instrumented by Orchestrion.

Problem

We can't use Sentry.experimentalUseDiagnosticsChannelInjection(), because the bundle would blow up, even if only one integration would be needed.

I was in between adding a new transform to every single config, but that would have meant that the bundle size would increase for the runtime config, which I didn't want to do, so I added a toSubscribeInjections function that is separately exported from all configs (not sure if that scales well)

Solution (for now)

__SENTRY_ORCHESTRION__.integrations is now added with a list of integrations via a virtual import with side effects. The registerChannelIntegrations() is actually here to do that. (In the future this list can be adapted in the best case, depending on what is really needed).

This is explicitly not adding anything into Cloudflare to keep it small, this is in the PR stack further up.

@JPeer264 JPeer264 self-assigned this Jul 8, 2026
@JPeer264
JPeer264 force-pushed the jp/orchestrion-integrations branch 3 times, most recently from 332ece3 to 31572d5 Compare July 14, 2026 15:40
@JPeer264

Copy link
Copy Markdown
Member Author

bugbot run

Comment thread packages/server-utils/src/orchestrion/bundler/vite.ts Outdated
Comment thread packages/server-utils/src/orchestrion/bundler/vite.ts Outdated
@JPeer264
JPeer264 force-pushed the jp/orchestrion-integrations branch from 31572d5 to 0ab49df Compare July 14, 2026 15:43
@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

⚠️ Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

Path Size % Change Change
@sentry/browser 27.75 kB - -
@sentry/browser - with treeshaking flags 26.18 kB - -
@sentry/browser (incl. Tracing) 46.56 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 48.37 kB - -
@sentry/browser (incl. Tracing, Profiling) 51.36 kB - -
@sentry/browser (incl. Tracing, Replay) 85.84 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 75.46 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 90.55 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 103.21 kB - -
@sentry/browser (incl. Feedback) 44.93 kB - -
@sentry/browser (incl. sendFeedback) 32.55 kB - -
@sentry/browser (incl. FeedbackAsync) 37.69 kB - -
@sentry/browser (incl. Metrics) 28.83 kB - -
@sentry/browser (incl. Logs) 29.05 kB - -
@sentry/browser (incl. Metrics & Logs) 29.76 kB - -
@sentry/react 29.54 kB - -
@sentry/react (incl. Tracing) 48.84 kB - -
@sentry/vue 33.17 kB - -
@sentry/vue (incl. Tracing) 48.52 kB - -
@sentry/svelte 27.78 kB - -
CDN Bundle 30.14 kB - -
CDN Bundle (incl. Tracing) 48.53 kB - -
CDN Bundle (incl. Logs, Metrics) 31.73 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 49.83 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 70.99 kB - -
CDN Bundle (incl. Tracing, Replay) 86.05 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 87.35 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 91.85 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 93.12 kB - -
CDN Bundle - uncompressed 89.88 kB - -
CDN Bundle (incl. Tracing) - uncompressed 146.73 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 94.59 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 150.71 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 219.35 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 265.96 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 269.93 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 279.67 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 283.62 kB - -
@sentry/nextjs (client) 51.36 kB - -
@sentry/sveltekit (client) 46.99 kB - -
@sentry/core/server 80.26 kB - -
@sentry/core/browser 66.69 kB - -
@sentry/node-core 63.21 kB - -
@sentry/node 125.73 kB - -
@sentry/node (incl. diagnostics channel injection) 149.77 kB +0.17% +252 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 70.03 kB +0.01% +2 B 🔺
@sentry/node/light 51.32 kB +0.01% +2 B 🔺
@sentry/node - without tracing 74.92 kB - -
@sentry/aws-serverless 84.15 kB - -
@sentry/cloudflare (withSentry) - minified 197.51 kB - -
@sentry/cloudflare (withSentry) 485.87 kB - -

View base workflow run

@JPeer264
JPeer264 force-pushed the jp/orchestrion-integrations branch 4 times, most recently from 95c6874 to c0dfebc Compare July 15, 2026 09:20
@JPeer264
JPeer264 marked this pull request as ready for review July 15, 2026 09:20
@JPeer264
JPeer264 requested a review from a team as a code owner July 15, 2026 09:20
@JPeer264
JPeer264 requested review from chargome, isaacs, s1gr1d and timfish and removed request for a team July 15, 2026 09:20
Comment thread packages/server-utils/src/orchestrion/bundler/vite.ts Outdated
Comment thread packages/server-utils/src/orchestrion/bundler/vite.ts Outdated
Comment thread packages/server-utils/test/orchestrion/vite-register-integrations.test.ts Outdated
Comment thread packages/server-utils/src/orchestrion/bundler/vite.ts Outdated
@JPeer264
JPeer264 force-pushed the jp/orchestrion-integrations branch from b341ad9 to 06971c5 Compare July 15, 2026 10:59
Comment thread packages/server-utils/src/orchestrion/bundler/vite.ts Outdated
Comment thread packages/server-utils/src/orchestrion/bundler/vite.ts Outdated
Comment thread packages/server-utils/src/orchestrion/bundler/vite.ts Outdated
Comment thread packages/server-utils/test/orchestrion/vite-register-integrations.test.ts Outdated
@JPeer264
JPeer264 force-pushed the jp/orchestrion-integrations branch from e7262f3 to 6713fc3 Compare July 15, 2026 11:38
Comment on lines +178 to +181
const require = createRequire(import.meta.url);
const packageRoot = dirname(require.resolve('@sentry/server-utils/package.json'));
// This avoids any backslash-escaping concerns on Windows
const resolvedRegisterModule = resolve(packageRoot, 'build/esm/orchestrion/index.js').replace(/\\/g, '/');

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not 100% clear what all this nastiness is for!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had it before, like I had it now pushed. But clankers were alwys like "You can't do this! You need to do it like this because XY". Since I have no idea what is hacky in bundlers and what not I went for this. I moved now point directly to the package, which also works for now.

Comment thread packages/server-utils/src/orchestrion/bundler/vite.ts Outdated
Comment thread packages/server-utils/src/orchestrion/bundler/vite.ts Outdated
@JPeer264
JPeer264 force-pushed the jp/orchestrion-integrations branch from 6713fc3 to 0d56181 Compare July 16, 2026 06:39
Comment thread packages/server-utils/src/orchestrion/index.ts Outdated
Comment thread packages/server-utils/src/orchestrion/detect.ts Outdated
Comment thread packages/server-utils/src/orchestrion/index.ts Outdated
Comment thread packages/server-utils/src/orchestrion/bundler/vite.ts Outdated
@JPeer264
JPeer264 force-pushed the jp/orchestrion-integrations branch from 4465fbd to b59ebba Compare July 16, 2026 07:33
Comment thread packages/server-utils/src/orchestrion/bundler/vite.ts Outdated
Comment thread packages/server-utils/src/orchestrion/index.ts Outdated
Comment thread packages/server-utils/src/orchestrion/index.ts Outdated

@isaacs isaacs left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure the best way forward to be honest, but I think there are some conflicts to comb through between this and the other orchestrion bundler stuff.

Comment thread packages/server-utils/package.json Outdated
Comment thread packages/server-utils/src/orchestrion/bundler/vite.ts Outdated
Comment thread packages/server-utils/src/orchestrion/bundler/vite.ts Outdated
@JPeer264
JPeer264 force-pushed the jp/orchestrion-integrations branch from b59ebba to 157e383 Compare July 17, 2026 06:57
Comment thread packages/server-utils/src/orchestrion/bundler/subscribeInjection.ts
@JPeer264
JPeer264 force-pushed the jp/orchestrion-integrations branch from 157e383 to 6755627 Compare July 17, 2026 07:21
Comment thread packages/server-utils/src/orchestrion/bundler/subscribeInjection.ts Outdated
Comment thread packages/server-utils/src/orchestrion/bundler/subscribeInjection.ts Outdated
Comment thread packages/server-utils/src/orchestrion/bundler/subscribeInjection.ts
@JPeer264
JPeer264 requested review from isaacs and timfish July 17, 2026 07:29
@JPeer264

Copy link
Copy Markdown
Member Author

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 3 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 6755627. Configure here.

Comment thread packages/server-utils/test/orchestrion/subscribeInjection.test.ts
Comment thread packages/server-utils/src/orchestrion/bundler/subscribeInjection.ts Outdated

@timfish timfish left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Only real feedback:

Rather than injecting this, you could export helpers from @sentry/server-utils/orchestrion that handles all of the below? It would save multiple imports?

(globalThis.__SENTRY_ORCHESTRION__ ??= {}).integrations ??= new Map();
import { ${exportName} } from '@sentry/server-utils/orchestrion';
import { getClient as __sentryGetClient } from '@sentry/core';

You could export register<MODULE_NAME>Integration for each and that handles the registration?

@isaacs isaacs left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a few comments on the other threads. Totally find to land as-is (pending rebasing to pull in new orchestrion integrations on develop, of course.)

I agree with @timfish's suggestion that the snippet could be trimmed up a bit, but I think we could make it even a bit more tight/bulletproof/deterministic by defining a helper method in server-utils to handle it.

I took a stab such a thing in isaacs/jp/orchestrion-integrations if you want to take a look, or you can git am the commit from here: https://gist.github.com/isaacs/190b6d5c2fbeb2da6a1a96c2bb5f8df4

I don't think that should be blocking if you don't think it's a clear win, though. This is good to land imo :) 👍

JPeer264 and others added 4 commits July 21, 2026 10:15
…ethod

Add a helper method to streamline the string snipped used by orchestrion
bundler integrations.

This removes the `getClient` import from `@sentry/core`, without adding
a hand-maintained export for each integration.
@JPeer264
JPeer264 force-pushed the jp/orchestrion-integrations branch from 713422f to 022aa6a Compare July 21, 2026 08:32
@JPeer264
JPeer264 merged commit 1cb9f4b into develop Jul 21, 2026
311 of 312 checks passed
@JPeer264
JPeer264 deleted the jp/orchestrion-integrations branch July 21, 2026 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants